const express = require('express');
const router = express.Router();
const config = require('../config');
const expressJWT = require('express-jwt');

// 引入路由处理函数
const user_handler = require('../router_handler/user');
const uploadImage = require('../public/upload'); // 修改引入的名称为 uploadImage

// 注册新用户
router.post('/register', user_handler.regUser);
// 登录
router.post('/login', user_handler.login);
// 退出登录
router.post('/logout', expressJWT({ secret: config.jwtSecretKey }), user_handler.logout);
// 上传图片
router.post('/upload', uploadImage); // 使用正确的引入名称

module.exports = router;
